package reg

import (
	"regexp"
	"strings"
)

func Reg(st string) []string {
	if len(st) == 0 {
		return []string{}
	}
	r1 := "^{|}$"               //头部是 { ,尾部是 }的字符串
	r2 := "(\".*:)"             //  " 和 :包裹的字符串 "sda":123
	re, _ := regexp.Compile(r1) //加载匹配模板
	//替换
	s1 := re.ReplaceAllString(st, "")
	//切割
	s2 := strings.Split(s1, ",")

	re, _ = regexp.Compile(r2)
	for i := range s2 {
		s2[i] = re.ReplaceAllString(s2[i], "")
	}

	return s2

}
